package com.dd.stack.redis.controller;

import com.dd.stack.common.util.Result;
import com.dd.stack.redis.pojo.req.OrderReq;
import com.dd.stack.redis.service.inner.impl.OrderServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * @Author liuxianmeng
 * @CreateTime 2025/1/31 11:43
 * @Description 订单
 */
@Slf4j
@RestController
@Api(tags = "订单")
@RequiredArgsConstructor
@ApiModel("OrderController")
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderServiceImpl osi;

    /**
     * 创建订单并发布到 Redis 频道
     * @param req 订单信息
     * @return 返回订单创建结果
     */
    @PostMapping("/create")
    public Result create(@RequestBody OrderReq req) {
        log.info("req = {}", req.toString());
        return osi.create(req);
    }
}
